// 创建Get请求对象
var CreateGetObject = function CreateGetObject (IsPaging, PageSize, PageIndex, QueryConditions, OrderByConditions) {
    var request = {
        isPaging: false,
        pageSize: 25,
        pageIndex: 1,
        postData: null,
        postDataList: null,
        queryConditions: [],
        orderByConditions: []
    }
    if (IsPaging !== undefined) {
        request.isPaging = IsPaging
    }
    if (PageSize !== undefined) {
        request.pageSize = PageSize
    }
    if (PageIndex !== undefined) {
        request.pageIndex = PageIndex
    }
    if (QueryConditions !== undefined) {
        request.queryConditions = QueryConditions
    }
    if (OrderByConditions !== undefined) {
        request.orderByConditions = OrderByConditions
    }
    return request
}
// 创建Post、Put、Delete请求对象
var CreatePostObject = function CreatePostObject (PostData, PostDataList) {
    var request = {
        postData: null,
        postDataList: null
    }
    if (PostData !== undefined) {
        request.postData = PostData
    }
    if (PostDataList !== undefined) {
        request.postDataList = PostDataList
    }
    return request
}

// 创建Post、Put、Delete请求对象
var CreatePutObject = function CreatePutObject (PostData, PostDataList) {
    var request = {
        postData: null,
        postDataList: null
    }
    if (PostData !== undefined) {
        request.postData = PostData
    }
    if (PostDataList !== undefined) {
        request.postDataList = PostDataList
    }
    return request
}


//创建删除请求对象
var CreateDeleteObject = function CreateDeleteObject (PostData, PostDataList) {
    var request = {
        postData: null,
        postDataList: null
    }
    if (PostData !== undefined) {
        request.postData = PostData
    }
    if (PostDataList !== undefined) {
        request.postDataList = PostDataList
    }
    return request
}

// 创建查询请求对象
var CreateQueryObject = function CreateQueryObject (QueryData) {
    var request = {
        isPaging: false,
        pageSize: 25,
        pageIndex: 1,
        postData: null,
        postDataList: null,
        queryConditions: null,
        orderByConditions: null
    }
    if (QueryData !== undefined) {
        request.queryConditions = QueryData
    }
    return request
}

/**
 * GetObject
 * 系统管理get请求
 *
 * @param {*提交对象用于单个} PostData
 * @param {*提交数组用于多个} postDataList
 * @param {*条件查询} QueryDataList
 */
var GetObject = function CreateQueryObject (PostData, postDataList, QueryDataList) {
    var request = {
        info: '',
        code: 0,
        totalNumber: 0,
        isPaging: false,
        pageSize: 0,
        pageIndex: 0,
        postData: null,
        postDataList: null,
        queryConditions: null,
        orderByConditions: null
    }
    if (PostData !== undefined) {
        request.postData = PostData
    }
    if (postDataList !== undefined) {
        request.postDataList = postDataList
    }
    if (QueryDataList !== undefined) {
        request.queryConditions = QueryDataList
    }
    return request
}

const RequestObject = {
    CreateGetObject: CreateGetObject,
    CreatePostObject: CreatePostObject,
    CreateQueryObject: CreateQueryObject,
    GetObject: GetObject,
    CreateDeleteObject: CreateDeleteObject,
    CreatePutObject: CreatePutObject
}

export default RequestObject
